<extend name="Base/common"/>
<block name="style">
    <style type="text/css">
       
       
        
        /*.weui-cell_access .weui-cell__ftnone:after{border-style:none;}*/
    </style>
</block>
<block name="body">
    <div class="content">
        <div class="login-logo"><img src="__IMG__/logo.jpg" /></div>
        <form class="formtijiao" action="" method="post">
            <div class="login-register mg-t-8 clearfix">
                
                    <ul class="register-kk">

                        <li><em>手机号码</em>
                            <input type="text" name="mobile"  placeholder="请输入手机号码" class="register-sh mobile" style="width:145px;" />
                            <span class="regt-yzm1 get_captcha" style="width:90px;font-size:14px;margin-left:0px;">获取验证码</span></li>


                        <li><em>验证码</em><input type="text"  placeholder="请输入验证码"  name="aptcha" class="register-sh captcha" /></li>
                    </ul>
                   
                    <input type="button"  value="登 录" class="login-btn weui-btn" />     
                
         </form>
    </div>

</block>
<block name="script">
    
    <script>

        Zepto(function($){


           $('.mobile').change(function(){
                var mobile=$(this).val();
                $.ajax({
                    type:'post',
                    data:{'mobile':mobile},
                    // dataType:'json',
                    url:"index.php?m=&c=user&a=check_mobile",
                    success:function(m){
                        if(m==1){
                           
                        }else if(m==0){
                            $('.get_captcha').hide();
                            popup.alert('对不起，仅支持广西号码注册，请刷新重试');
                            return false;
                        }
                    },

                })
            })

             $('.get_captcha').click(function(){
                var  e = $(this);
                if(e.hasClass('disabled')!=false) return false;
                var mobile = $('.mobile').val();//手机号码
                // popup.alert(mobile);
                e.html('发送中..').addClass('disabled');
                //随机验证码
                var t='';
                for(var i=0;i<6;i++){
                    t+=Math.floor(Math.random()*10);
                }
                
                $.ajax({
                    async:false,
                    type:'post',
                    url:"{:U('User/sendsms')}",
                    data:{'mobile':mobile,'t':t},
                    dataType:'json',
                    success:function(msg){

                        if(msg===0){
                            confirm('该手机已绑定！')         
                            location.href='https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=MzIwOTQ3MTg5OQ==&scene=124#wechat_redirect'; 


                        }else if(msg.status ==true){
                            FormCountDown();//倒计时再次发送短信
                            $.ajax({
                                async:false,
                                type:'get',
                                url:'http://sh2.ipyy.com/smsJson.aspx?action=send&userid=&account=jkwl362&password=ndp987&mobile='+mobile+'&content=【西西钱包】您的验证码是'+t+'，请勿泄露他人，请在十分钟内使用。&sendTime=&extno=',
                                dataType:'json',
                                success:function(res){
                                    popup.alert(res);
                                }
                            });
                        }else{
                            e.html('获取验证码').removeClass('disabled');
                            popup.alert(msg.info);
                        }
                    }
                });

            });

            $('.weui-btn').click(function(){
                var mobile  = $('.mobile').val();
                var captcha = $('.captcha').val();
                // popup.alert(captcha)
                if(mobile==''){
                    popup.alert('手机号码不能为空');return false;
                }
                if(captcha==''){
                    popup.alert('验证码不能为空');return false;
                }
                // if(!$('.xuexin').is(':checked')) {
                //     popup.alert('请同意借款服务与隐私协议');return false;
                // }
                $.ajax({
                    type:'post',
                    url:"{:U('User/mobile')}",
                    data:{'mobile':mobile,'captcha':captcha},
                    dataType:'json',
                    success:function(msg){
                        // alert(msg)
                        if(msg.status==true){
                            popup.alert(msg.info,msg.url);
                        }else{
                            popup.alert(msg.info);return false;
                        }
                    }
                });
                
            }) ;
        
  }) ;

    </script>

</block>